#include <stdio.h>
#include <stdlib.h>

typedef struct treeNode{
	char data;
	struct treeNode * lchild;
	struct treeNode * rchild;
	struct treeNode * parent;
}treeNode,*pTree;
int creatTree(pTree & T);
int putTree(const pTree & T);
int main(){
	pTree T;
	creatTree(T);
	putTree(T);
	return 0;
}

int creatTree(pTree & T){
	char ch;
	scanf("%c",&ch);
	if(ch != '#'){
		if(!(T = (pTree)malloc(sizeof(treeNode)))) return 2;
		T->data = ch;
	}
	else{
		T = NULL;
		return 0;
	}
	creatTree(T->lchild);
	creatTree(T->rchild);
	return 1;
}

int putTree(const pTree & T){
	printf("data is %c \n",T->data);
	if(T->lchild)
		putTree(T->lchild);
	if(T->rchild)
		putTree(T->rchild);
	return 1;
}